﻿#include <iostream>
using namespace std;
int main()
{
	int t;
	cin >> t;
	for (int i = 0; i < t; i++)
	{
		int arr[2][3] = { 0 };
		int (*p)[3] = arr;
		for (int i = 0; i < 2; i++)
		{
			for (int j = 0; j < 3; j++)
			{
				cin >> p[i][j];
			}
		}
		int arr1[3][2] = { 0 };//定义新的数组防止越界
		int (*pc)[2] = arr1;
		for (int i = 0; i < 2; i++)
		{
			for (int j = 0; j < 3; j++)
			{
				 pc[2 - j][i]=p[i][j] ;//找出规律
			}
		}
		for (int i = 0; i < 3; i++)
		{
			for (int j = 0; j < 2; j++)
			{
				cout << pc[i][j] << " ";
			}
			cout << endl;
		}
	}
	return 0;
}
